/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.ArrayList;

/**
 *
 * @author TAN
 */
public class QuyDinhDAO {
   private Connect connect=null;

   public QuyDinhDAO(String User ,String Pass,String port,String DataBase,String Host) {
        connect =new Connect( User , Pass, port, DataBase, Host);
    }
    public boolean SuaQuyDinh(int SoNguoiToiDa,int SoNgayHuy,float DonGia)
    {
        Connection conn=connect.GetConnect();
        try
        {
            CallableStatement cals=conn.prepareCall("{call sp_SuaQuyDinh(?,?,?)}"); 
            cals.setInt(1, SoNguoiToiDa);
            cals.setInt(2, SoNgayHuy);
            cals.setFloat(3,DonGia);
            cals.execute();
        }
        catch(Exception e)
        {
            CloseConnect();
           return false; 
        }
        CloseConnect();
        return true;
    }
    public ResultSet ThongTinQuyDinh()
    {   ResultSet rs=null;
       Connection conn=connect.GetConnect();
        try
        {
            CallableStatement cals=conn.prepareCall("{call sp_ThongTinQuyDinh()}"); 
            rs=cals.executeQuery();
        }
        catch(Exception e)
        {
          
        }
        return rs;
    }
    public void CloseConnect()
      {
          try
          {
          connect.Close();
          }catch(Exception e)
          {
              ;
          }
      }
}
